home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-04-19 | 471 b | 15 lines |
- class Fruit { }
- class Apple extends Fruit {
- public static void main(String[] args) {
- Apple[] a = new Apple[1];
- Fruit[] f = new Fruit[1];
- Object[] o = new Object[1];
- if (a instanceof Fruit[])
- System.out.println("a inherits from Fruit[]");
- if (f instanceof Object[])
- System.out.println("f inherits from Object[]");
- if (o instanceof Object)
- System.out.println("o inherits from Object");
- }
- }
-